export default {
    data() {
        return {
            ruleForm: {
                username: "test",
                password: "test",
            },
            rules: {
                username: [
                    { required: true, message: `${this.$t('login.holder_username')}`, trigger: 'blur' },
                ],
                password: [
                    { required: true, message: `${this.$t('login.holder_password')}`, trigger: 'change' }
                ],
            }
        };
    },
    methods: {
        submitForm(formName) {
            this.$refs[formName].validate(async (valid) => {
                if (valid) {
                    await this.$store.dispatch('user/login', this.ruleForm)
                    this.$router.push({ path: this.redirect || "/" });
                }
            });
        },
        resetForm(formName) {
            this.$refs[formName].resetFields();
        }
    }
}